/*
 * @Author: SamZhang samzhang@apjcorp.com
 * @Date: 2022-12-02 10:14:44
 * @LastEditors: SamZhang samzhang@apjcorp.com
 * @LastEditTime: 2023-02-16 15:52:42
 * @FilePath: /circulation-web/tests/browser/signInFailure.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
module.exports = {

  /**
   * The log in error page contains a simple message and a link to go back
   * to the log in page.
   */
  "go to the error page with bad log in credentials": (browser) => {
    const errorMessage = "p";
    const tryAgainButton = "a";
    const applocation_root = localStorage.getItem("MOBEBR_CONFIG_APPLICATION_ROOT");

    browser
      .resizeWindow(1200, 900)
      .signIn("bad email", "bad password")
      .waitForElementVisible("body", 10000)
      .expect.element(errorMessage).text.to.contain("401 ERROR");
    
    browser
      .assert.attributeContains(tryAgainButton, "href", applocation_root+"/admin/sign_in");
    
    browser.end();
  }
};
